/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "sucursal", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sucursal.findAll", query = "SELECT s FROM Sucursal s"),
    @NamedQuery(name = "Sucursal.findByIdsucursal", query = "SELECT s FROM Sucursal s WHERE s.idsucursal = :idsucursal"),
    @NamedQuery(name = "Sucursal.findBySucDescrip", query = "SELECT s FROM Sucursal s WHERE s.sucDescrip = :sucDescrip")})
public class Sucursal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idsucursal", nullable = false)
    private Integer idsucursal;
    @Column(name = "suc_descrip")
    private Integer sucDescrip;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sucursal")
    private Collection<Deposito> depositoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sucursal")
    private Collection<Stock> stockCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idsucursal")
    private Collection<PlanillaPago> planillaPagoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idsucursal")
    private Collection<CompraCab> compraCabCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idsucursal")
    private Collection<PedidoCab> pedidoCabCollection;

    public Sucursal() {
    }

    public Sucursal(Integer idsucursal) {
        this.idsucursal = idsucursal;
    }

    public Integer getIdsucursal() {
        return idsucursal;
    }

    public void setIdsucursal(Integer idsucursal) {
        this.idsucursal = idsucursal;
    }

    public Integer getSucDescrip() {
        return sucDescrip;
    }

    public void setSucDescrip(Integer sucDescrip) {
        this.sucDescrip = sucDescrip;
    }

    @XmlTransient
    public Collection<Deposito> getDepositoCollection() {
        return depositoCollection;
    }

    public void setDepositoCollection(Collection<Deposito> depositoCollection) {
        this.depositoCollection = depositoCollection;
    }

    @XmlTransient
    public Collection<Stock> getStockCollection() {
        return stockCollection;
    }

    public void setStockCollection(Collection<Stock> stockCollection) {
        this.stockCollection = stockCollection;
    }

    @XmlTransient
    public Collection<PlanillaPago> getPlanillaPagoCollection() {
        return planillaPagoCollection;
    }

    public void setPlanillaPagoCollection(Collection<PlanillaPago> planillaPagoCollection) {
        this.planillaPagoCollection = planillaPagoCollection;
    }

    @XmlTransient
    public Collection<CompraCab> getCompraCabCollection() {
        return compraCabCollection;
    }

    public void setCompraCabCollection(Collection<CompraCab> compraCabCollection) {
        this.compraCabCollection = compraCabCollection;
    }

    @XmlTransient
    public Collection<PedidoCab> getPedidoCabCollection() {
        return pedidoCabCollection;
    }

    public void setPedidoCabCollection(Collection<PedidoCab> pedidoCabCollection) {
        this.pedidoCabCollection = pedidoCabCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idsucursal != null ? idsucursal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sucursal)) {
            return false;
        }
        Sucursal other = (Sucursal) object;
        if ((this.idsucursal == null && other.idsucursal != null) || (this.idsucursal != null && !this.idsucursal.equals(other.idsucursal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.Sucursal[ idsucursal=" + idsucursal + " ]";
    }
    
}
